<template>
	<view class="task-item">
		<view>
			<icon-layers :style="{ color: '#165DFF',marginRight: '12px',fontSize: '18px' }" />
			<text class="arco-modal-title">{{ info.name }}</text>
		</view>
		<view class="desc-box">
			<a-descriptions size="small" :data="infoData" :column="1" />
		</view>
		<view class="bottom-box">
			<block v-if="info.status === 0">
				<a-tag color="green">正在火热征集中</a-tag>
			</block>
			<block v-if="info.status === -1">
				<a-tag color="gray">征集已结束</a-tag>
			</block>
			<a-button type="outline"  @click="toInfo">任务详情</a-button>
		</view>
	</view>
</template>

<script setup>
	import { computed } from 'vue'
	
	const props = defineProps({
		info: {
			type: Object,
			default: () => ({})
		}
	})
	
	const infoData = computed(() => {
		return [{
			label: '征集时间',
			value: props.info.startAt + '~'+ props.info.endAt,
		}, {
			label: '征集方式',
			value: props.info.method,
		}, {
			label: '征集数量',
			value: props.info.number,
		}, {
			label: '已征集',
			value: props.info.haved,
		}]
	})
	
	const toInfo = () => {
		uni.navigateTo({
			url: '/pages/Info?id='+ props.info.id
		})
	}
</script>

<style scoped lang="scss">
	.task-item {
		background-color: #fff;
		padding: 28rpx;
		margin-bottom: 20rpx;
		box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
	}

	.desc-box {
		background-color: #F3F5F7;
		padding: 20rpx 40rpx;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
	}

	.bottom-box {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
</style>